package labox.innovation.gameserver.model.actor.knownlist;

import labox.innovation.gameserver.model.L2Object;
import labox.innovation.gameserver.model.actor.L2Attackable;
import labox.innovation.gameserver.model.actor.L2Character;
import labox.innovation.gameserver.model.actor.L2Playable;
import labox.innovation.gameserver.model.actor.instance.FuzeNpcInstance;

/**
 * 有攻击能力的NPC的可视列表
 * @author Administrator
 *
 */
public class AttackableKnownList extends NpcKnownList {

	public AttackableKnownList(L2Attackable activeChar) {
		super(activeChar);
	}

	// =========================================================
	// Method - Public
	@Override
	public boolean removeKnownObject(L2Object object) {
		if (!super.removeKnownObject(object))
			return false;

		// 如果是个角色从仇恨列表中删除对象
		if (object instanceof L2Character)
			getActiveChar().getAggroList().remove(object);

		return true;
	}

	// =========================================================
	// Method - Private

	// =========================================================
	// Property - Public
	@Override
	public L2Attackable getActiveChar() {
		return (L2Attackable) _activeObject;
	}

	@Override
	public int getDistanceToForgetObject(L2Object object) {
		if (getActiveChar().getAggroList().get(object) != null)
			return 200;
		return Math.min(100, 2 * getDistanceToWatchObject(object));
	}

	@Override
	public int getDistanceToWatchObject(L2Object object) {
		if (object instanceof FuzeNpcInstance || !(object instanceof L2Character))
			return 0;

		if (object instanceof L2Playable)
			return 50;

		return 300;
	}
}
